#!/usr/bin/env node


const log = console.log;
const Router = require('koa-router');
const router = new Router();

router.get('/authors/', (ctx, next) => {
    const {page, size} = ctx.query;
    log(`查询漫画书作者列表, page=${page}, size=${size}`);
    ctx.body = '查询成功';
})
router.get('/authors/:authorName', (ctx, next) => {
    const {authorName} = ctx.params;
    log(`查询漫画书作者 by name = ${authorName}`);
    ctx.body = '查询成功';
});
router.post('/authors/', (ctx, next) => {
    const {authorName} = ctx.request.body;
    log(`添加漫画书作者, authorName=${authorName}`);
    ctx.body = '添加成功';
});
router.put('/authors/:id', (ctx, next) => {
    const {id} = ctx.params;
    const {authorName} = ctx.request.body;
    log(`修改漫画书作者, id=${id} authorName=${authorName} `);
    ctx.body = '修改成功';
});
router.delete('/authors/:id', (ctx, next) => {
    const {id} = ctx.params;
    const {authorName} = ctx.request.body;
    log(`删除漫画书作者, id=${id} authorName=${authorName} `);
    ctx.body = '删除成功';
});

module.exports = router;